package com.dawn.module.hospital.dal.mysql.chs.config;

import java.util.*;

import com.dawn.framework.common.pojo.PageResult;
import com.dawn.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.dawn.framework.mybatis.core.mapper.BaseMapperX;
import com.dawn.module.hospital.dal.dataobject.chs.config.ChsConfigDO;
import org.apache.ibatis.annotations.Mapper;
import com.dawn.module.hospital.controller.admin.chs.config.vo.*;

/**
 * 医保支付配置 Mapper
 *
 * @author mamba 4 left
 */
@Mapper
public interface ChsConfigMapper extends BaseMapperX<ChsConfigDO> {

    default PageResult<ChsConfigDO> selectPage(ChsConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ChsConfigDO>()
                .eqIfPresent(ChsConfigDO::getAppId, reqVO.getAppId())
                .likeIfPresent(ChsConfigDO::getAppName, reqVO.getAppName())
                .eqIfPresent(ChsConfigDO::getAppType, reqVO.getAppType())
                .eqIfPresent(ChsConfigDO::getOrgAppId, reqVO.getOrgAppId())
                .eqIfPresent(ChsConfigDO::getOrgChnlCrtfCodg, reqVO.getOrgChnlCrtfCodg())
                .likeIfPresent(ChsConfigDO::getChannelName, reqVO.getChannelName())
                .eqIfPresent(ChsConfigDO::getChannel, reqVO.getChannel())
                .eqIfPresent(ChsConfigDO::getCityCode, reqVO.getCityCode())
                .eqIfPresent(ChsConfigDO::getOrgCodg, reqVO.getOrgCodg())
                .eqIfPresent(ChsConfigDO::getPartnerId, reqVO.getPartnerId())
                .eqIfPresent(ChsConfigDO::getPartnerSecret, reqVO.getPartnerSecret())
                .eqIfPresent(ChsConfigDO::getChannelOauthUrl, reqVO.getChannelOauthUrl())
                .eqIfPresent(ChsConfigDO::getChannelUserUrl, reqVO.getChannelUserUrl())
                .eqIfPresent(ChsConfigDO::getRedirectUrl, reqVO.getRedirectUrl())
                .eqIfPresent(ChsConfigDO::getHisOrderUrl, reqVO.getHisOrderUrl())
                .eqIfPresent(ChsConfigDO::getHisConfirmUrl, reqVO.getHisConfirmUrl())
                .eqIfPresent(ChsConfigDO::getHisRefundUrl, reqVO.getHisRefundUrl())
                .eqIfPresent(ChsConfigDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ChsConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ChsConfigDO::getId));
    }

}